Flatpak (Background + Q&A)

OpenCPN is available for several popular linux platforms. However, linux itself is available in many different “flavors”, otherwise known as “distributions”. Previously, if OpenCPN was not available pre-built for a user's particular favorite distribution, then one was required to build OpenCPN from source for that distribution. This is inconvenient, and requires a level of knowledge and skill beyond the capabilities or interest of many potential OpenCPN users. Adaptation of OpenCPN to Flatpak allows use with almost any modern linux distribution without any complex building from source, including important distributions such as Fedora, Suse, and Arch.

Flatpak is a system in which an application (OpenCPN, in this case) is run inside of a “sandbox” under the control of the linux standard linux operating system of choice. This differs from a “virtualized” environment, wherein there exists a completely separate instance of a “guest” operating system. Flatpak thus has the advantage of a simpler and more robust installation, without affecting installed user applications or interfaces of the native operating system. As simple examples, the file systems and network ports of the target system are available to OpenCPN Flatpak without any special configuration requirements.

FlatPak applications can be built so as to enjoy tight integration with existing Desktop Package Management systems. Under this scheme, Flatpak applications may be installed with a simple one-click operation, and updated along with other system applications using provided O/S tools.

There are a couple of downsides to Flatpak. First, the exact screen presentation (the GUI) of an application may not match exactly what would be seen on a purely native implementation. Usually, the differences are very minor, and do not detract from the user experience. Secondly, the initial load and first run of a Flatpak adapted application will be slower than that of a native application. Subsequent runs will, however, be not noticeably slower to load than a native application.

Implementation and Use

OpenCPN for Flatpak has been implemented to operate under a generic sandbox environment. While the choice of sandbox environment is somewhat flexible, experience has shown that choosing a stable, less-than-cutting-edge sandbox promotes stability of the application at runtime. Generally, a user should not be concerned with the sandbox model selected by the developers. Think of the sandbox as a generic and stable linux environment which is known to be OpenCPN-friendly. As mentioned, Flatpak requires a fairly large runtime environment. This runtime environment consists, essentially, of the interfaces which convert from OpenCPN's expectation of library support, to the available libraries on the target system. This environment will be downloaded during the installation process of OpenCPN Flatpak, and will thereafter be available for fast OpenCPN application startup. OpenCPN Flatpak is not (yet) installable from the Desktop (GUI), as we have not submitted the OpenCPN Flatpak application for inclusion in the global flathub repository system. This is a work-in process. For initial Beta testing, OpenCPN Flatpak should be installed from the Command Line Interface.

Here is an example of the detailed steps required to install and run OpenCPN under Flatpak, using the Command Line Interface of a debian-like linux.

1. Get the Flatpak base application for your operating system. For Debian based systems, use some version of apt, e.g.

$ sudo apt install flatpak

For other distributions (for example RedHat or Fedora based systems), use the corresponding system command to download and install “flatpak” base application. For Fedora, this would look something like:

$ sudo yum install flatpak

Consult https://flatpak.org/setup for more information on other linux distributions.

2. Enable the flathub repository:

$ flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

3. Install OpenCPN for Flatpak

$ flatpak install --user  https://flathub.org/repo/appstream/org.opencpn.OpenCPN.flatpakref

This command will initiate a fairly long download, as mentioned above. Current sandbox images download about 450 MB.

4. Run OpenCPN Flatpak from CLI

$ flatpak run org.opencpn.OpenCPN

5. Run OpenCPN from the desktop GUI (if available), by selecting the OpenCPN icon installed automatically.

6. As required, update OpenCPN Flatpak (Beta) from the CLI.

$ flatpak update org.opencpn.OpenCPN

7. Install OpenCPN Flatpak from a GUI like Gnome or KDE: Under development for OpenCPN. Look for more information as it develops.

Status

OpenCPN Flatpak is in initial Beta testing stage. All testing feedback will be greatly appreciated. Especially useful will be descriptions of installation difficulties of any sort. Also, reports of successful installations or failures on truly odd-ball linux distributions are encouraged.

FAQs.

1. Q: I am running Ubuntu linux. Tell me again why I should run, or even try, OpenCPN Flatpak? A: You probably would not want to run OpenCPN Flatpak, since OpenCPN is natively supported for Ubuntu. Downloads and updates are available for Ubuntu as normal from the OpenCPN PPA repository. But just to be clear: yes, you may run OpenCPN Flatpak on Ubuntu, if you would just like to try it out. It has some advantages…

2. Q: What if my ancient linux system does not support Flatpak at all? A: We suggest that you update your system, in whatever way seems natural, until you reach a distribution that does support Flatpak. At the moment, some 23 linux distributions are Flatpak capable. See a list here: https://flatpak.org/setup/

3. Q: What about Plugins? A: OpenPCN Flatpak relies on the managed plugin interface introduced in version 5.1 (Beta). There are no “legacy” plugins available for OpenCPN Flatpak. Some number of popular managed plugins are available for OpenCPN Flatpak now, more are on the horizon. You can help us prioritize resources by telling us which plugins are missing from OpenCPN Flatpak, that you would really like to see…

4. Q: Can I use a oesenc license purchased for a native installation when using flatpak? A: No, the flatpak sandbox is seen as a another computer and requires a separate license.

5. Q: Will a flatpak installation pickup the configuration from a previous native installation? A: No, flatpak uses a separate location for configuration files.

6. Q: Where can I learn more? A: https://flatpak.org/ https://itsfoss.com/flatpak-guide/ (Nice overview/HOWTO article)